/*
 * @Description: 登记 - 格式转换相关接口
 * @Author: Rfan
 * @Date: 2022-11-23 11:27:41
 * @LastEditTime: 2022-11-23 18:35:23
 */

import request from '@/utils/request';
import { Key } from 'react';
import { IPageQuery } from '@/interfaces/global';

export interface IRegConversionListParams {
  archiveTypeId?: number;
  archiveTypeName?: string;
  businessStage?: string;
  createTime?: string;
  detectionJobId?: number;
  detectionPerson?: string;
  detectionResult?: number;
  detectionTime?: string;
  detectionType?: number;
  efileCount?: number;
  fileCount?: number;
  folderCount?: number;
  fondsId?: number;
  fondsName?: string;
  fondsNo?: string;
  id?: number;
  operator?: number;
  operatorName?: string;
  operatorTime?: string;
  registrant?: string;
  registrationTime?: string;
  remark?: string;
}

// 分页查询格式转换登记列表
export function fetchRegConversionListByPage(data: IPageQuery<IRegConversionListParams>) {
  return request({
    url: `/register-migration/page`,
    method: 'post',
    data
  });
}

export interface IAddRegConversionParams {
  completeDesc: string;
  description: string;
  endTime: string;
  fileCount: number;
  managementAuth: string;
  registrant: string;
  registrationTime: string;
  remark: string;
  responsibleDept: string;
  sourceFormat: string;
  startTime: string;
  targetFormat: string;
  type: number;
  unitName: string;
}

// 添加格式转换登记条目
export function addRegConversion(data: IAddRegConversionParams) {
  return request({
    url: `/register-migration/`,
    method: 'post',
    data
  });
}

export interface IEditRegConversionParams extends IAddRegConversionParams {
  id: number;
}
// 编辑格式转换登记条目
export function editRegConversion(data: IEditRegConversionParams) {
  return request({
    url: `/register-migration/`,
    method: 'put',
    data
  });
}

// 删除格式转换登记条目
export function deleteRegConversionItem(id: Key) {
  return request({
    url: `/register-migration/${id}`,
    method: 'delete'
  });
}
